package com.ittable.tableshow.mapper;


import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;


@Mapper
public interface TableMapper {
    @Select("SELECT * FROM ${tableName}")
    List<Map<String, Object>> getTableList(@Param("tableName") String tableName);

    @Select("SELECT table_name FROM information_schema.tables WHERE table_schema = 'try';")
    List<Map<String, Object>> getTableNames();

    @Select("SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = 'try' AND TABLE_NAME = '${tableName}';")
    List<Map<String, Object>> getTableInfo(String tableName);

    // 新增的方法，用于获取与特定数据集关联的表名列表
    @Select("SELECT dt.table_name FROM dataset_tables dt JOIN dataset d ON dt.dataset_id = d.id WHERE d.name = #{datasetName}")
    List<String> getTablesByDatasetName(@Param("datasetName") String datasetName);


}


